package weaver.aiyh_pcn.async_organization.model;

import org.jetbrains.annotations.NotNull;

/**
 * @author EBU7-dev1-ayh
 * @create 2021/7/20 0020 17:18
 * 部门实体类
 */


public class Department implements Comparable<Department>{
	/**部门ID*/
	private Long DEPARTMENTID;
	/**部门名称*/
	private String DEPARTMENTNAME;
	/**上级部门ID 此处为0时，表示该部门为根部门。对应所属公司，从【一级部门对应实体mapping表】上取值*/
	private Long PARENTDEPARTMENDID;


	public String getValue(String fieldName){
		if("DEPARTMENTID".equals(fieldName)) {
			return String.valueOf(this.getDEPARTMENTID());
		}
		if("DEPARTMENTNAME".equals(fieldName)) {
			return this.getDEPARTMENTNAME();
		}
		if("PARENTDEPARTMENDID".equals(fieldName)) {
			return String.valueOf(this.getPARENTDEPARTMENDID());
		}
		return null;
	}

	public Department() {
	}

	public Department(Long DEPARTMENTID, String DEPARTMENTNAME, Long PARENTDEPARTMENDID) {
		this.DEPARTMENTID = DEPARTMENTID;
		this.DEPARTMENTNAME = DEPARTMENTNAME;
		this.PARENTDEPARTMENDID = PARENTDEPARTMENDID;
	}

	public Long getDEPARTMENTID() {
		return DEPARTMENTID;
	}

	public void setDEPARTMENTID(Long DEPARTMENTID) {
		this.DEPARTMENTID = DEPARTMENTID;
	}

	public String getDEPARTMENTNAME() {
		return DEPARTMENTNAME;
	}

	public void setDEPARTMENTNAME(String DEPARTMENTNAME) {
		this.DEPARTMENTNAME = DEPARTMENTNAME;
	}

	public Long getPARENTDEPARTMENDID() {
		return PARENTDEPARTMENDID;
	}

	public void setPARENTDEPARTMENDID(Long PARENTDEPARTMENDID) {
		this.PARENTDEPARTMENDID = PARENTDEPARTMENDID;
	}



	@Override
	public String toString() {
		return "Department{" +
				"DEPARTMENTID='" + DEPARTMENTID + '\'' +
				", DEPARTMENTNAME='" + DEPARTMENTNAME + '\'' +
				", PARENTDEPARTMENDID='" + PARENTDEPARTMENDID + '\'' +
				'}';
	}

	@Override
	public int compareTo(@NotNull Department o) {
		return new Long(this.PARENTDEPARTMENDID - o.getPARENTDEPARTMENDID()).intValue();
	}
}
